fix: guard alexander/conway/jones — CI hung to GitHub's 6h kill on O(n!) determinant - #82
Merged
Merged
Conversation
…ed O(n!) determinant Every KRL Verification run since KnotTheory#43 merged died at GitHub's 6-hour job kill (reported 'cancelled') inside the axioms step. Root cause: quandle_descriptor computed alexander/conway/jones unguarded, and KnotTheory's alexander_polynomial evaluates its polynomial-matrix minor determinant by naive cofactor expansion — O(n!) in crossing count (measured on s1^n torus closures: 12 → 12s, 13 → 106s, 16 → 6h+). conway_polynomial calls alexander_polynomial, inheriting the cost. Before KnotTheory#43, the braid strand-swap bug made the suite's 16-crossing s1^16 fixture degenerate and cheap, which is how the missing guards passed unnoticed — a correctness fix upstream turned a degenerate input into a genuine (2,16)-torus-link diagram. - alexander/conway guarded at 12 crossings, jones at 20 (KnotTheory's Kauffman bracket throws above 20; measured 2.8s at 16 — the throw becomes a sentinel). Same 'deferred:too_many_crossings' sentinel as the existing HOMFLY guard. BR-5's 4-12-crossing corpus is entirely below the bounds, so fuzz-covered descriptors are unchanged. - timeout-minutes on all three CI jobs (krl-tests 90) so a future hang fails in minutes, not 6 hours of runner time. - The KT-2 exact-value fixture suite (issue #32) had never actually executed — it merged behind the hang. First run caught conway(figure_eight) = -(1 - z²): a genuine upstream sign bug on mixed-sign diagrams (KnotTheory#42 — Conway has no legitimate unit ambiguity since ∇(unknot)=1). Marked @test_broken citing #42. - Upstream perf issue filed: KnotTheory#46 (proposes Bareiss fraction-free elimination, O(n^3) polynomial ops). Validated locally (Julia 1.12.6, sibling checkouts at KnotTheory#43+): full axioms suite completes in minutes, all pass, exactly 1 expected Broken (the conway marker); BR-5 fuzz at CI's 50 trials green with its 1 expected Broken (quandle_key order-sensitivity, #42). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
hyperpolymath
marked this pull request as ready for review
July 27, 2026 13:03
hyperpolymath
added a commit
that referenced
this pull request
Jul 28, 2026
…s 12 → 128 (unblocks red main) (#85) ## Summary **`main` is currently red and this unblocks it.** KnotTheory.jl#48 merged, so quandledb's `@test_broken` on `conway(figure_eight)` now reports **"Unexpected Pass"** — a hard error, and precisely the forcing signal the marker existed to produce. Reproduced locally against KnotTheory `a2f2938`. ### 1. Conway marker → hard assertion Upstream now normalises Alexander to **Δ(1) = +1** (the Conway normalisation) instead of "leading coefficient positive", which was the wrong canonical choice on mixed-sign knots. `conway(figure_eight)` = `1 − z²` exactly, so the assertion is restored. ### 2. Alexander/Conway bounds: 12 → 128 The bound of 12 in #82 was calibrated against the **O(n!)** cofactor determinant that #48 replaced with **O(n³)** Bareiss elimination. Re-measured on `s1^n` torus closures (the worst case — no arc merging): | crossings | alexander, Bareiss | alexander, cofactor (before) | |---|---|---| | 16 | ~0 s | **> 6 h** (the CI kill) | | 40 | 0.07 s | — | | 100 | 0.10 s | — | | 140 | 0.61 s | — | 128 keeps the worst case sub-second while covering every realistic diagram. **Jones (20) and HOMFLY (15) are unchanged** — those are genuinely exponential (Kauffman bracket 2ⁿ; skein recursion), and their bounds come from upstream's own limits. ### 3. Guard testset reworked With the three bounds now an order of magnitude apart, one diagram can no longer exercise them all — the old single-fixture test would have silently stopped testing the alexander/conway guard. It now covers: - **16 crossings** — only HOMFLY defers; alexander, conway and jones must all be *real* values. - **130 crossings** — all four defer, with an explicit `@test length(pd.crossings) > ALEXANDER_MAX_CROSSINGS` so that raising the bound without raising the fixture fails loudly instead of going quiet. ## Verification Full axioms suite against KnotTheory `a2f2938`: passes with **zero broken markers** — a first for this suite. ## Note on the BR-5 fuzz residual Re-measured at 200 trials: **still exactly 11/200**, unchanged by #48. My expectation that the sign fix would shrink it was **wrong** — the mismatches are not caused by the alexander/conway sign convention. A component-level diagnostic is running to identify the actual cause; the `@test_broken` counter marker stays until that is known, and the finding will be posted to KnotTheory#42 (and appended here if it changes anything in this PR). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the defect that has killed every
KRL Verificationrun since KnotTheory#43 merged: the Julia job ran until GitHub's 6-hour job limit and died (reported ascancelled— check job duration, not conclusion, to tell this apart from the repo's routine concurrency cancels).Root cause
quandle_descriptorcomputedalexander_polynomial/conway_polynomial/jones_polynomialunguarded. Upstream, Alexander's polynomial-matrix minor determinant is naive cofactor expansion — O(n!) in crossing count — and Conway calls Alexander, inheriting the cost. Measured ons1^ntorus closures (the worst case):Before KnotTheory#43, the braid strand-swap bug made the axioms suite's 16-crossing
s1^16fixture a degenerate, cheap diagram — which is exactly how the missing guards went unnoticed. The upstream correctness fix turned it into a genuine (2,16)-torus-link diagram and exposed the latent performance hole. Guards calibrated against buggy inputs are not load-bearing.Changes
HOMFLY_MAX_CROSSINGSpattern, samedeferred:too_many_crossingssentinel): alexander ≤ 12, conway ≤ 12, jones ≤ 20 (KnotTheory's Kauffman bracket throws above 20; measured a fine 2.8 s at 16 — the throw becomes a sentinel). BR-5's 4–12-crossing fuzz corpus sits entirely below the bounds, so every fuzz-covered descriptor is byte-identical to before.timeout-minuteson all three CI jobs (krl-tests 90, agda 30, tlaplus 15) — a future hang fails in minutes instead of burning 6 h of runner time.conway(figure_eight)=-(1 − z²): a genuine sign bug on mixed-sign diagrams (Conway has no legitimate unit ambiguity since ∇(unknot)=1). Marked@test_brokenciting KnotTheory#42; data point posted there.Verification (local, Julia 1.12.6, siblings at KnotTheory#43+)
test_quandle_axioms.jl: completes in minutes (previously: never), all testsets pass, exactly 1 expected Broken (the new conway marker).test_br5_fuzz.jlat CI's 50 trials: all pass, 1 expected Broken (quandle_keyorder-sensitivity counter, 3/50 — consistent with the known 11/200; KnotTheory#42).The KRL Verification run on this PR completing at all — in ~30 min instead of dying at 6 h — is the primary acceptance signal.
🤖 Generated with Claude Code